<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>User Dashboard</title>
    <style>
        /* Reset some basic styling */
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: Arial, sans-serif;
            line-height: 1.6;
            background-color: #f4f4f4;
        }

        /* Header Styles */
        header {
            background-color: #333;
            color: white;
            padding: 1rem;
            text-align: center;
        }

        header .logo h1 {
            margin: 0;
        }

        nav ul {
            list-style-type: none;
            padding: 0;
        }

        nav ul li {
            display: inline;
            margin: 0 15px;
        }

        nav ul li a {
            color: white;
            text-decoration: none;
            font-weight: bold;
        }

        nav ul li a:hover {
            text-decoration: underline;
        }

        /* Main Section */
        main {
            padding: 2rem;
        }

        /* User Information Section */
        .user-info {
            background-color: white;
            padding: 1rem;
            margin-bottom: 2rem;
            border-radius: 8px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
        }

        .user-info h2 {
            margin-bottom: 1rem;
            font-size: 1.5rem;
        }

        .user-info p {
            font-size: 1.2rem;
        }

        /* Book List Section */
        .book-list {
            background-color: white;
            padding: 1rem;
            border-radius: 8px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
        }

        .book-list h2 {
            margin-bottom: 1rem;
            font-size: 1.5rem;
        }

        table {
            width: 100%;
            border-collapse: collapse;
        }

        table, th, td {
            border: 1px solid #ddd;
        }

        th, td {
            padding: 8px;
            text-align: left;
        }

        th {
            background-color: #f4f4f4;
        }

        /* Footer Section */
        footer {
            background-color: #333;
            color: white;
            text-align: center;
            padding: 1rem;
            position: fixed;
            width: 100%;
            bottom: 0;
        }
    </style>
</head>
<body>
<!-- Header Section -->
<header>
    <div class="logo">
        <h1>Welcome to the Library</h1>
    </div>
    <nav>
        <ul>
            <li><a href="/user">Home</a></li>
            <li><a href="/profile">Profile</a></li>
            <li><a href="/logout">Logout</a></li>
        </ul>
    </nav>
</header>

<!-- Main Content Section -->
<main>
    <section class="user-info">
        <h2>User Information</h2>
        <p><strong>Username:</strong> <span id="username">JohnDoe</span></p>
        <p><strong>Email:</strong> <span id="email">johndoe@example.com</span></p>
        <p><strong>Role:</strong> <span id="role">USER</span></p>
    </section>

    <section class="book-list">
        <h2>Your Book List</h2>
        <table>
            <thead>
            <tr>
                <th>Title</th>
                <th>Author</th>
                <th>ISBN</th>
                <th>Actions</th>
            </tr>
            </thead>
            <tbody id="bookList">
            <!-- Books will be dynamically populated here -->
            <tr>
                <td>Spring in Action</td>
                <td>Craig Walls</td>
                <td>9781617294945</td>
                <td><a href="/book/1">View</a></td>
            </tr>
            <tr>
                <td>Java in Action</td>
                <td>John Smith</td>
                <td>9781118295797</td>
                <td><a href="/book/2">View</a></td>
            </tr>
            </tbody>
        </table>
    </section>
</main>

<!-- Footer Section -->
<footer>
    <p>&copy; 2024 Library Management System</p>
</footer>

<script>
    // This script will dynamically load book data if needed
    document.addEventListener("DOMContentLoaded", function() {
        // Fetch book data (this is just an example, replace with actual data fetching if necessary)
        const bookList = document.getElementById('bookList');

        // Example of dynamic data rendering, assuming you fetch the book list from the backend
        const books = [
            { title: "Spring in Action", author: "Craig Walls", isbn: "9781617294945" },
            { title: "Java in Action", author: "John Smith", isbn: "9781118295797" }
        ];

        // Clear existing list
        bookList.innerHTML = "";

        // Render books
        books.forEach(book => {
            const tr = document.createElement('tr');
            tr.innerHTML = `
                    <td>${book.title}</td>
                    <td>${book.author}</td>
                    <td>${book.isbn}</td>
                    <td><a href="/book/${book.isbn}">View</a></td>
                `;
            bookList.appendChild(tr);
        });
    });
</script>
</body>
</html>




<!--<!DOCTYPE html>-->
<!--<html xmlns:th="http://www.thymeleaf.org">-->
<!--<head>-->
<!--    <title>User Page</title>-->
<!--</head>-->
<!--<body>-->
<!--<h2>Welcome User</h2>-->
<!--<p>This is the user page.</p>-->
<!--</body>-->
<!--</html>-->
